﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinCourseControls
{
    public partial class FrmNumericUpDown : Form
    {
        public FrmNumericUpDown()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 增加按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            numericUpDown1.UpButton();//增加inCrement设置的数值
        }

        /// <summary>
        /// 减少按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlus_Click(object sender, EventArgs e)
        {
            numericUpDown1.DownButton(); //减少inCrement设置的数值
        }

        /// <summary>
        /// value值改变事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if(numericUpDown1.Value>5000)
            {
                MessageBox.Show("入库数量太多！");
            }
            else
            {
                lblCount.Text = numericUpDown1.Value.ToString();
            }
        }
    }
}
